package routers

import (
	"choujiang/controllers"
	"github.com/astaxie/beego"
)

func init() {
	//var FilterUser = func(c *context.Context) {
	//	if strings.Index(c.Request.RequestURI, "/auth") != -1 {
	//		return
	//	}
	//	if strings.Index(c.Request.RequestURI, "/login") != -1 {
	//		return
	//	}
	//	if strings.Index(c.Request.RequestURI, "/error") != -1 {
	//		return
	//	}
	//}
	//beego.InsertFilter("*", beego.BeforeRouter, FilterUser)

	beego.Router("/", &controllers.MainController{})
	beego.Router("/message",&controllers.MainController{},"*:Message")
	beego.Router("/login", &controllers.MainController{}, "*:Login")
	beego.Router("/auth/code", &controllers.MainController{}, "*:GetCodeAndAuth")
	beego.Router("/error", &controllers.MainController{}, "*:Error")

	beego.Router("/login/device", &controllers.MainController{}, "*:DeviceLogin")

	beego.Router("/loginuser", &controllers.MainController{}, "*:Login_USER")

	//device
	beego.Router("/device/qrcode", &controllers.DeviceController{}, "*:GetQrcodePage")
	beego.Router("/device/refreshtoken", &controllers.DeviceController{}, "*:RefreshToken")
	beego.Router("/device/updatetime", &controllers.DeviceController{}, "*:UpdateTime")
	beego.Router("/device/prisepage", &controllers.DeviceController{}, "*:GetPrisePage")
	beego.Router("/device/getresult", &controllers.DeviceController{}, "*:GetPriseResult")
	beego.Router("/device/join", &controllers.DeviceController{}, "*:JoinToSocket")


	//choujiang
	beego.Router("/user/scan", &controllers.ChouJiangController{}, "*:GetPage")
	beego.Router("/user/tradepage", &controllers.ChouJiangController{}, "*:TradePoint")
	beego.Router("/user/trade", &controllers.ChouJiangController{}, "*:Trade")
	beego.Router("/user/getresult", &controllers.ChouJiangController{}, "*:GetPriseResult")
	beego.Router("/user/userinfo", &controllers.ChouJiangController{}, "*:GetUserinfo")

}
